﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Data
{
    public interface IGenericRepository
    {
        /// <summary>
        /// Sauvegarde une entité en base
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        void Save<T>(T entity) where T : class;

        /// <summary>
        /// Sauvegarde une liste d'entité
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entities"></param>
        void SaveRange<T>(IEnumerable<T> entities) where T : class;

        /// <summary>
        /// Permet d'obtenir tous les enregistrement d'une table
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        T[] GetAll<T>() where T : class;

        /// <summary>
        /// Permet d'obtenir tous l'enregistrement d'une table par son ID
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        T GetById<T>(object id) where T : class;

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        IQueryable<T> GetQueryable<T>() where T : class;

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        void Delete<T>(T entity) where T : class;
    }
}